/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __700A081B_ECE1_4D4C_B4F1_E7847C281328__
#define __700A081B_ECE1_4D4C_B4F1_E7847C281328__

#include "../tools/head.h"

/////////////////////////////////////////////////////////////////////////////////////////
// 

namespace xos_box
{

    // 
    // lock_free_queue impl
    // 
    class lock_free_queue_impl : public xos_stl::mem_item< xos::release_impl< lock_free_queue_impl >, thread_lock >,
        public i_lock_free_queue
    {
	public:
        typedef xos::release_impl< lock_free_queue_impl > T;

    public:
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        static int get_xos_item_data( ITEM_DATA*& item_ptr );
        static int static_user_init();
        static int static_user_term();

    public:
        lock_free_queue_impl();
        ~lock_free_queue_impl();

    public:
        int init();
        int term();

    protected:
        LOCK_FREE_INTERFACE_QUEUE m_queue;

    public:
        int push_back( xos::i_release* pT );
        xos::i_release* pop_front();
        int release_all();
    };
}

#endif // __700A081B_ECE1_4D4C_B4F1_E7847C281328__
